package com.bit.frige.recipe;

import com.bit.frige.R;
import com.bit.frige.R.id;
import com.bit.frige.R.layout;
import com.bit.frige.R.menu;

import android.os.Bundle;
import android.annotation.SuppressLint;
import android.app.Activity;
import android.content.Intent;
import android.content.pm.ActivityInfo;
import android.view.Menu;
import android.webkit.WebSettings;
import android.webkit.WebView;
import android.webkit.WebViewClient;

public class RecipeWebActivity extends Activity {
	
	WebView webview;
	
	@SuppressLint("SetJavaScriptEnabled")
	@SuppressWarnings("deprecation")
	@Override
	protected void onCreate(Bundle savedInstanceState) {
		super.onCreate(savedInstanceState);
		setContentView(R.layout.activity_recipe_web);
		setRequestedOrientation(ActivityInfo.SCREEN_ORIENTATION_PORTRAIT);
        Intent intent = getIntent();
        String url = intent.getStringExtra("url");
		
		
//		webview = (WebView)findViewById(R.id.webview); 
//        webview.setWebViewClient(new WebClient()); // 응용프로그램에서 직접 url 처리 
//        WebSettings set = webview.getSettings(); 
//        set.setJavaScriptEnabled(true); 
//        set.setBuiltInZoomControls(true); 
//        set.setUserAgent(1);
//        set.setUseWideViewPort(false);
//       // webview.loadUrl(url); 
//        webview.loadUrl("http://www.google.com"); 
//        
        
        
        webview = (WebView)this.findViewById(R.id.webview);
        webview.setWebViewClient(new MyWebClient());
		WebSettings set = webview.getSettings();
		set.setJavaScriptEnabled(true);
		set.setBuiltInZoomControls(true);
		webview.loadUrl(url); 
		
	}
	


	@Override
	public boolean onCreateOptionsMenu(Menu menu) {
		// Inflate the menu; this adds items to the action bar if it is present.
		getMenuInflater().inflate(R.menu.recipe_web, menu);
		return true;
	}
	
	class MyWebClient extends WebViewClient {         
		public boolean shouldOverrideUrlLoading(WebView view, String url) {
			view.loadUrl(url);
			return true;
		}

	}
}
